import fetch from 'utils/fetch';

// 广告管理

// 列表展示
export function listAdvertByCondition(advertName, advertType, advertStatus, issue, provinceId, cityId, areaId, curPage, pageSize, carousel) {
    const data = {
        advertName, //广告名称
        advertType, //广告类型
        advertStatus, //广告状态
        issue, //发布人
        provinceId, //省Id
        cityId, //市id
        areaId, //区县Id
        curPage,
        pageSize,
        carousel
    };
    return fetch({
        url: '/advert/listAdvertByCondition',
        method: 'post',
        data
    });
}

// 查看广告
export function getAdvertInfoById(advertId) {
    const data = {
        advertId
    };
    return fetch({
        url: '/advert/getAdvertInfoById',
        method: 'post',
        data
    });
}

//7. 广告审核 通过/驳回
export function auditAdvert(advertId, advertStatus, desc) {
    const data = {
        advertId,
        advertStatus,
        desc
    };
    return fetch({
        url: '/advert/auditAdvert',
        method: 'post',
        data
    });
}

//2. 编辑广告
export function updateAdvert(
    advertName,
    advertType,
    remark,
    appType,
    advertPic,
    iosOnePic,
    iosTwoPic,
    iosThreePic,
    androidPic,
    showTime,
    weight,
    showType,
    link,
    html,
    provinceId,
    cityId,
    areaId,
    advertId
) {
    const data = {
        advertName,
        advertType,
        remark,
        appType,
        advertPic,
        iosOnePic,
        iosTwoPic,
        iosThreePic,
        androidPic,
        showTime,
        weight,
        showType,
        link,
        html,
        provinceId,
        cityId,
        areaId,
        advertId
    };
    return fetch({
        url: '/advert/updateAdvert',
        method: 'post',
        data
    });
}

//1. 添加广告
export function saveAdvert(
    advertName,
    advertType,
    remark,
    appType,
    advertPic,
    iosOnePic,
    iosTwoPic,
    iosThreePic,
    androidPic,
    showTime,
    weight,
    showType,
    link,
    html,
    provinceId,
    cityId,
    areaId
) {
    const data = {
        advertName,
        advertType,
        remark,
        appType,
        advertPic,
        iosOnePic,
        iosTwoPic,
        iosThreePic,
        androidPic,
        showTime,
        weight,
        showType,
        link,
        html,
        provinceId,
        cityId,
        areaId
    };
    return fetch({
        url: '/advert/saveAdvert',
        method: 'post',
        data
    });
}
//6. 总部发的广告直接上线
export function uplodAdvert(advertId, isPush, pushMessage) {
    const data = {
        advertId,
        isPush,
        pushMessage
    };
    return fetch({
        url: '/advert/uplodAdvert',
        method: 'post',
        data
    });
}

//5. 广告下线

export function updateAdvertStatus(advertId) {
    const data = {
        advertId
    };
    return fetch({
        url: '/advert/updateAdvertStatus',
        method: 'post',
        data
    });
}
//8. 批量删除
export function batchDeleteAdvert(advertId) {
    const data = {
        advertId
    };
    return fetch({
        url: '/advert/batchDeleteAdvert',
        method: 'post',
        data
    });
}

// 发布广告权重权限
export function listOrgRegionMapInfo() {
    return fetch({
        url: '/advert/listOrgRegionMapInfo',
        method: 'post'
    })
}